package listbyorder.access001_100.test24;

import listbyorder.utils.ListNode;

/**
 * @author code_yc
 * @version 1.0
 * @date 2020/5/29 15:10
 */
public class Solution1 {

    // 递归
    public ListNode swapPairs(ListNode head) {
        if (head == null || head.next == null) return head;
        ListNode next = head.next.next;
        ListNode new_head = head.next;
        new_head.next = head;
        head.next = swapPairs(next);
        return new_head;
    }
}
